From: Jasper St. Pierre Date: Mon, 14 Oct 2013 01:52:44 +0000 (-0400) Subject: messageTray: Split out the notification's destroy handler X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~3205 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=25fd23e7036270b286b9274bd529499eaee85e74;p=gnome-shell.git messageTray: Split out the notification's destroy handler This is complex enough to split out. https://bugzilla.gnome.org/show_bug.cgi?id=710115 --- diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index 9dfb54cec..76ba60bc3 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -1406,23 +1406,24 @@ const Source = new Lang.Class({ return this._mainIcon.actor; }, + _onNotificationDestroy: function(notification) { + let index = this.notifications.indexOf(notification); + if (index < 0) + return; + + this.notifications.splice(index, 1); + if (this.notifications.length == 0) + this._lastNotificationRemoved(); + + this.countUpdated(); + }, + pushNotification: function(notification) { if (this.notifications.indexOf(notification) >= 0) return; notification.connect('clicked', Lang.bind(this, this.open)); - notification.connect('destroy', Lang.bind(this, - function () { - let index = this.notifications.indexOf(notification); - if (index < 0) - return; - - this.notifications.splice(index, 1); - if (this.notifications.length == 0) - this._lastNotificationRemoved(); - - this.countUpdated(); - })); + notification.connect('destroy', Lang.bind(this, this._onNotificationDestroy)); this.notifications.push(notification); this.emit('notification-added', notification);